﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using NetCoreCMS.Common;
using NetCoreCMS.IServices;

namespace NetCoreCMS.Web.Areas.Web.Controllers
{
    public class LiveController : UserController
    {
        public ILiveService _live { get; set; }
        public IActionResult Index()
        {
            return View(userModel);
        }
        [HttpPost]
        public IActionResult OnLine()
        {
            int user_id = CMSRequest.GetFormInt("user_id", HttpContext);
            var live = _live.GetFirst(user_id);
            live.online = 1;
            _live.Update(live);
            return Content("1");
        }
        [HttpPost]
        public IActionResult OffLine()
        {
            int user_id = CMSRequest.GetFormInt("user_id", HttpContext);
            var live = _live.GetFirst(user_id);
            live.online = 0;
            _live.Update(live);
            return Content("1");
        }
    }
}